package com.burgess.net.queue;

import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.context.ApplicationContext;

import javax.jms.JMSException;
import javax.jms.QueueReceiver;
import javax.jms.TextMessage;

/**
 * 消息接受者
 * 创建人    BurgessLee
 * 创建时间   2020/5/21
 * 描述
 */
public class Receiver {

    public static void main(String[] args) throws JMSException {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        QueueReceiver queueReceiver = (QueueReceiver) applicationContext.getBean("queueReceiver");
        TextMessage msg = (TextMessage) queueReceiver.receive();
        System.out.println("收到的消息是:" + msg.getText().toString());
    }

}
